import React from "react";
import { Button } from "antd";
import { ArrayItems } from "@formily/antd";

interface Props {
  style?: React.CSSProperties;
}

const ArrayRemoveBtn: React.FC<Props> = (props) => {
  const arrayObj = (ArrayItems as any).useArray();
  const index = (ArrayItems as any).useIndex();

  return (
    <Button
      {...props}
      type="primary"
      danger
      onClick={() => {
        if (arrayObj.field) {
          arrayObj.field.remove(index);
        }
      }}
    >
      删除 IdcInfo
    </Button>
  );
};

export default ArrayRemoveBtn;
